package com.ghj.pojo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @author ghj
 * @create 2023-06-16 10:34
 */
//@Component  组件
@Component  //相当于 <bean id="user" class="com.ghj.pojo.User"/>
public class User {

    @Value("张三")    //相当于 <property name="name" value="张三"/>
    private String name;

    public String getName() {
        return name;
    }

    @Value("张三")    //也可用在set方法上
    public void setName(String name) {
        this.name = name;
    }
}
